home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue60 / COMThrd / MultipleSTAClientForm.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2000-06-07  |  944 b   |  53 lines

  1. unit MultipleSTAClientForm;
  2.  
  3. interface
  4.  
  5. uses
  6.   MultipleSTAServer_TLB,
  7.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  8.   StdCtrls;
  9.  
  10. type
  11.   TForm2 = class(TForm)
  12.     CheckBox1: TCheckBox;
  13.     CheckBox2: TCheckBox;
  14.     CheckBox3: TCheckBox;
  15.     CheckBox4: TCheckBox;
  16.     CheckBox5: TCheckBox;
  17.     CheckBox6: TCheckBox;
  18.     CheckBox7: TCheckBox;
  19.     procedure CheckBoxClick(Sender: TObject);
  20.   end;
  21.  
  22. var
  23.   Form2: TForm2;
  24.  
  25. implementation
  26.  
  27. {$R *.DFM}
  28.  
  29. procedure TForm2.CheckBoxClick(Sender: TObject);
  30. var
  31.   Chk: TCheckBox;
  32.   Server: ISTAObject;
  33. begin
  34.   Chk := Sender as TCheckBox;
  35.   if Assigned(Chk) then
  36.   begin
  37.     if Chk.Checked then
  38.     begin
  39.       Server := CoSTAObject.Create;
  40.       Server._AddRef;
  41.       Chk.Tag := Longint(Server)
  42.     end
  43.     else
  44.     begin
  45.       Server := ISTAObject(Chk.Tag);
  46.       Server._Release;
  47.       Chk.Tag := 0
  48.     end;
  49.   end
  50. end;
  51.  
  52. end.
  53.